package com.test;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import com.common.entity.A_customer;
import com.common.entity.A_goods;
import com.common.entity.A_timeRules;
import com.common.entity.A_transfer;
import com.common.utils.StringUtils;
import com.cxh.dao.A_evaluateDao;
import com.cxh.dao.A_goodsDao;
import com.cxh.dao.impl.A_evaluateDaoImpl;
import com.cxh.dao.impl.A_goodsDaoImpl;
import com.lyk.dao.A_customerDao;
import com.lyk.dao.A_timeRulesDao;
import com.lyk.dao.impl.A_customerDaoImpl;
import com.lyk.dao.impl.A_timeRulesDaoImpl;
import com.lyk.service.A_transferService;
import com.lyk.service.impl.A_transferServiceImpl;

public class testCustomer {
	@Test
	public void test1(){
		A_customerDao customerDao = new A_customerDaoImpl();
		List<A_customer> lc = customerDao.findByCondition(null);
		for(A_customer c : lc){
			System.out.println(c.getCustomer_id()+ c.getRealName());
		}
	}
	@Test
	public void test2(){
		A_timeRulesDao timeRulesDao = new A_timeRulesDaoImpl();
		A_timeRules timeRules = timeRulesDao.findById(2);
		System.out.println(timeRules.getTimeLimit()+ ","+timeRules.getTimeRules_id());
	}
	@Test
	public void test3(){
		A_goodsDao gd = new A_goodsDaoImpl();
		Map<String,Object> mp = new HashMap<String, Object>();
		mp.put("goods_name", "��");
		List<A_goods> lg = gd.findByCondition(mp);
		for(A_goods g:lg){
			System.out.println(g.getMinPrice()+" "+g.getGoods_name());
		}
	}
	
	@Test
	public void test4(){
		Map<String, Object> map=new HashMap<String, Object>();
		map.put("transfer_date","2017-8-11");
		A_transferService transferService = new A_transferServiceImpl();
		List<A_transfer> lt = transferService.findByCondition(map);
		if(lt!=null && lt.size()>0){
			System.out.println(lt.get(0).getTransfer_id());
		}
	}
	@Test
	public void test5(){
		A_evaluateDao ed = new A_evaluateDaoImpl();
		Map<String, Object> mp=new HashMap<String, Object>();
		mp.put("eva_msg","大闸蟹");
		mp.put("eva_score",90);
		mp.put("customer_id",2);
		mp.put("eva_date",StringUtils.str2DateBySql("2017-08-13", null, new Date(), true));
		mp.put("issee",0);
		if(ed.addA_evaluate(mp)==1)
			System.out.println("完成");
		/*if(ed.deleteA_evaluate(4)>0)
			System.out.println("完成");*/
	}
}
